<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>有 54 张牌，请模拟⽃地主发牌给三个⼈，底牌留三张</title>
</head>

<body>

</body>

</html>
<script>
     var array = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,
            22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,
            41,42,43,44,45,46,47,48,49,50,51,52,53,54];
        function res(array){
            for(var i = array.length - 1 ; i>0 ; i--){
                //生成array.length长度之间的随机数
                var obj = Math.floor(Math.random()*(i+1));
                //交换
                [array[i],array[obj]] = [array[obj],array[i]];
            }        
            return array;
        }
        var all = res(array);
        var pai1 = all.slice(0,17);
        var pai2 = all.slice(17,34);
        var pai3 = all.slice(34,51);
        var di = all.slice(51,54);
        console.log('玩家1:  '+pai1);
        console.log('玩家2:  '+pai2);
        console.log('玩家3:  '+pai3);
        console.log('底牌:  '+di);
</script>